class Solution
{
public:
    vector<bool> prefixesDivBy5(vector<int> &nums)
    {
        int n = nums.size();
        vector<bool> result(n);
        int mod = 0;
        for (int i = 0; i < n; ++i)
        {
            mod = mod * 2 + nums[i];
            mod %= 5;
            result[i] = mod == 0;
        }
        return result;
    }
};